<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Promise的all方法使用</title>
</head>
<body>

<script>
    Promise.all([
        new Promise((resolve => {
            setTimeout(() => {
                resolve("result1")
            }, 2000)
        })),
        new Promise((resolve => {
            setTimeout(() => {
                resolve("result2")
            }, 4000)
        }))
    ]).then(results => {
        console.log(results[0]);
        console.log(results[1]);
    })

    // const shareObj = {
    //     name: "why"
    // }
    //
    // Vue.prototype.shareObj = shareObj
</script>

</body>
</html>